// 管理这个项目的所有接口
import axios from "./request"

// 请求首页数据
export const GetHomeData = () => axios.get("/index/index");

// export const GetHomeData = function(){
//     return axios.get("/index/index");
// }

// 请求搜索页面数据  （GET没有带参数的写法）
export const GetSearchPopupData = () => axios.get("/search/index");


// 请求搜索页的提示列表数据  (GET带有参数的写法)
export const GetSearchTipsListData = (params) => axios.get("/search/helper",{params});


// 搜索框商品的搜索请求
export const GetSearchData = (params) => axios.get("/goods/list",{params});

// 清除历史记录
export const ClearHistory = (params) => axios.post("/search/clearhistory",params);

// 登录请求
export const UserLogin = (params) => axios.post("/auth/loginByWeb",params);


// 获取商品详情信息
export const GetGoodsDetail = (params) => axios.get("/goods/detail",{params});

// 获取相关商品
export const GetGoodsRelated = (params) => axios.get("/goods/related",{params});


// 获取购物车商品数量
export const GetCartNum = () => axios.get("/cart/goodscount");


// 添加到购物车请求
export const ToAddCart = (params) => axios.post("/cart/add",params);



// 请求购物车列表数据
export const GetCartData = () => axios.get("/cart/index");


// 购物车中，选中和取消选中的请求
export const ChangeGoodsChecked = (params) => axios.post("/cart/checked",params);


// 步进器的修改的请求
export const SeptNum = (params) => axios.post("/cart/update",params);

// 删除商品的请求
export const DelGoods = (params) => axios.post("/cart/delete",params);
/*
推理过程：
export const GetSearchTipsListData = (obj) => axios.get("/search/helper",{
    params:obj
});
把obj写成 params
*/

// post的写法
// export const GetSearchTipsListData = (params) => axios.post("/search/helper",params);